#include "ros/ros.h"
#include "testMsgs1/Person.h"

void Handler(const testMsgs1::Person::ConstPtr& ptr)
{
    ROS_INFO("收到个人信息：name->%s, age->%d, grade->%lf", ptr->name.c_str(), ptr->age, ptr->grade);
}

int main(int argc, char *argv[])
{
    setlocale(LC_ALL, "");
    ros::init(argc, argv, "listener");
    ros::NodeHandle nh;
    ros::Subscriber sub = nh.subscribe("chatter", 10, Handler);

    ros::spin();
    return 0;
}
